package com.hospital.pet.love.lovepethospital.util;

import com.hospital.pet.love.lovepethospital.exp.ShawCustomException;
import com.hospital.pet.love.lovepethospital.resp.ResultCodeEnum;

/**
 * @author RoselleShaw
 * @create 2024-04-26 20:18
 */
public class RoleJudgeUtil {

    public static void consumerJudge() {
        if (!"客户".equals(AuthenticationContextUtil.get().getRole())) {
            throw new ShawCustomException(ResultCodeEnum.NOT_CONSUMER);
        }
    }

    public static void employeeJudge() {
        if (!"员工".equals(AuthenticationContextUtil.get().getRole())) {
            throw new ShawCustomException(ResultCodeEnum.NOT_EMPLOYEE);
        }
    }

    public static void adminJudge() {
        if (!"超级管理员".equals(AuthenticationContextUtil.get().getRole())) {
            throw new ShawCustomException(ResultCodeEnum.NOT_ADMIN);
        }
    }

}
